;(self.webpackChunkmp_webgl = self.webpackChunkmp_webgl || []).push([
	[321],
	{
		92011: (e, t) => {
			"use strict"
			var s = (t.uO = {})
			;(s.read = function (e, t) {
				return e.readFields(s._readField, { chunk: [], quantized_chunk: [] }, t)
			}),
				(s._readField = function (e, t, s) {
					1 === e
						? t.chunk.push(a.read(s, s.readVarint() + s.pos))
						: 2 === e && t.quantized_chunk.push(d.read(s, s.readVarint() + s.pos))
				}),
				(s.write = function (e, t) {
					if (e.chunk) for (var s = 0; s < e.chunk.length; s++) t.writeMessage(1, a.write, e.chunk[s])
					if (e.quantized_chunk)
						for (s = 0; s < e.quantized_chunk.length; s++) t.writeMessage(2, d.write, e.quantized_chunk[s])
				})
			var r = {}
			;(r.read = function (e, t) {
				return e.readFields(r._readField, { xyz: [], uv: [] }, t)
			}),
				(r._readField = function (e, t, s) {
					1 === e ? s.readPackedFloat(t.xyz) : 2 === e && s.readPackedFloat(t.uv)
				}),
				(r.write = function (e, t) {
					e.xyz && t.writePackedFloat(1, e.xyz), e.uv && t.writePackedFloat(2, e.uv)
				})
			var i = {}
			;(i.read = function (e, t) {
				return e.readFields(i._readField, { faces: [] }, t)
			}),
				(i._readField = function (e, t, s) {
					1 === e && s.readPackedVarint(t.faces)
				}),
				(i.write = function (e, t) {
					e.faces && t.writePackedVarint(1, e.faces)
				})
			var a = {}
			;(a.read = function (e, t) {
				return e.readFields(a._readField, { vertices: null, faces: null, chunk_name: "", material_name: "" }, t)
			}),
				(a._readField = function (e, t, s) {
					1 === e
						? (t.vertices = r.read(s, s.readVarint() + s.pos))
						: 2 === e
						? (t.faces = i.read(s, s.readVarint() + s.pos))
						: 3 === e
						? (t.chunk_name = s.readString())
						: 4 === e && (t.material_name = s.readString())
				}),
				(a.write = function (e, t) {
					e.vertices && t.writeMessage(1, r.write, e.vertices),
						e.faces && t.writeMessage(2, i.write, e.faces),
						e.chunk_name && t.writeStringField(3, e.chunk_name),
						e.material_name && t.writeStringField(4, e.material_name)
				})
			var o = {}
			;(o.read = function (e, t) {
				return e.readFields(o._readField, { quantization: 0, translation: [], x: [], y: [], z: [] }, t)
			}),
				(o._readField = function (e, t, s) {
					1 === e
						? (t.quantization = s.readFloat())
						: 2 === e
						? s.readPackedFloat(t.translation)
						: 3 === e
						? s.readPackedSVarint(t.x)
						: 4 === e
						? s.readPackedSVarint(t.y)
						: 5 === e && s.readPackedSVarint(t.z)
				}),
				(o.write = function (e, t) {
					e.quantization && t.writeFloatField(1, e.quantization),
						e.translation && t.writePackedFloat(2, e.translation),
						e.x && t.writePackedSVarint(3, e.x),
						e.y && t.writePackedSVarint(4, e.y),
						e.z && t.writePackedSVarint(5, e.z)
				})
			var n = {}
			;(n.read = function (e, t) {
				return e.readFields(n._readField, { name: "", quantization: 0, u: [], v: [] }, t)
			}),
				(n._readField = function (e, t, s) {
					1 === e
						? (t.name = s.readString())
						: 2 === e
						? (t.quantization = s.readFloat())
						: 3 === e
						? s.readPackedSVarint(t.u)
						: 4 === e && s.readPackedSVarint(t.v)
				}),
				(n.write = function (e, t) {
					e.name && t.writeStringField(1, e.name),
						e.quantization && t.writeFloatField(2, e.quantization),
						e.u && t.writePackedSVarint(3, e.u),
						e.v && t.writePackedSVarint(4, e.v)
				})
			var h = {}
			;(h.read = function (e, t) {
				return e.readFields(h._readField, { faces: [] }, t)
			}),
				(h._readField = function (e, t, s) {
					1 === e && s.readPackedSVarint(t.faces)
				}),
				(h.write = function (e, t) {
					e.faces && t.writePackedSVarint(1, e.faces)
				})
			var d = {}
			;(d.read = function (e, t) {
				return e.readFields(
					d._readField,
					{
						chunk_name: "",
						material_name: "",
						vertices: null,
						uvs: [],
						faces: null
					},
					t
				)
			}),
				(d._readField = function (e, t, s) {
					1 === e
						? (t.chunk_name = s.readString())
						: 2 === e
						? (t.material_name = s.readString())
						: 3 === e
						? (t.vertices = o.read(s, s.readVarint() + s.pos))
						: 4 === e
						? t.uvs.push(n.read(s, s.readVarint() + s.pos))
						: 5 === e && (t.faces = i.read(s, s.readVarint() + s.pos))
				}),
				(d.write = function (e, t) {
					if (
						(e.chunk_name && t.writeStringField(1, e.chunk_name),
						e.material_name && t.writeStringField(2, e.material_name),
						e.vertices && t.writeMessage(3, o.write, e.vertices),
						e.uvs)
					)
						for (var s = 0; s < e.uvs.length; s++) t.writeMessage(4, n.write, e.uvs[s])
					e.faces && t.writeMessage(5, i.write, e.faces)
				})
		},
		26203: (e, t, s) => {
			"use strict"
			s.r(t), s.d(t, { default: () => MeshQueryModule })
			var r = s(88512),
				i = s(47724),
				a = s(17399),
				o = s(86488),
				n = s(26627)
			const h = (...e) =>
				function (t) {
					return e.every(e => e(t))
				}
			var d = s(51245),
				l = s(2212)
			const u = new r.Z("mesh-query-module")
			class MeshQueryModule extends i.Y {
				constructor() {
					super(...arguments), (this.name = "mesh-query")
				}
				async init(e, t) {
					const [s, r, i] = await Promise.all([
						t.market.waitForData(n.i),
						t.market.waitForData(o.Z),
						t.getModule(a.default)
					])
					;(this.raycaster = i), (this.floorData = s), (this.roomData = r)
				}
				nearestMeshInfoOnFloor(e, t) {
					const s = h(d.$4.isRoomMesh, d.$4.matchesFloorId(t))
					return this.raycaster.picking.nearest(new l.Vector3().set(e.x, e.y, e.z), s)
				}
				nearestMeshInfo(e) {
					return this.raycaster.picking.nearest(new l.Vector3().set(e.x, e.y, e.z), d.$4.isRoomMesh)
				}
				inferMeshIdsFromPoint(e, t) {
					const s = !e.roomId || !this.roomData.get(e.roomId),
						r = !e.floorId || !this.floorData.hasFloor(e.floorId)
					if (s || r) {
						const i = r ? d.$4.isRoomMesh : h(d.$4.isRoomMesh, d.$4.matchesFloorId(e.floorId)),
							a = this.raycaster.picking.nearest(new l.Vector3().set(t.x, t.y, t.z), i)
						a && d.$4.isRoomMesh(a.object)
							? (u.debug(
									"data-fixup:",
									s ? { roomId: a.object.roomId, prev: e.roomId } : "",
									r ? { floorId: a.object.floorId, prev: e.floorId } : "",
									{ data: e }
							  ),
							  s && (e.roomId = a.object.roomId),
							  r && (e.floorId = a.object.floorId))
							: u.warn("Nearest Room/Floor not found for:", {
									point: t,
									data: e,
									invalidRoomId: s,
									invalidFloorId: r
							  })
					}
					return e
				}
			}
		},
		33512: (e, t, s) => {
			"use strict"
			s.d(t, { Z: () => MeshTrimData })
			var r = s(32770),
				i = s(75256),
				a = s(64781),
				o = s(56247),
				n = s(88512),
				h = s(28719)
			const d = new n.Z("MeshTrimData")
			class MeshTrimData extends r.V {
				constructor(e, t) {
					super(),
						(this.numberOfTrims = 0),
						(this.meshTrimsByFloorIndex = new a.v()),
						(this.meshTrimsById = new a.v()),
						(this.maxNameIndex = -1)
					for (const e of t) {
						const t = e.index,
							s = new i.d()
						this.meshTrimsByFloorIndex.set(`${t}`, s)
					}
					try {
						this.add(...Object.values(e))
					} catch (e) {}
				}
				add(...e) {
					const t = new Set()
					let s = !1
					if (this.maxNameIndex <= 0) {
						const t = this.meshTrimsById.values.map(e => e.nameIndex),
							s = t.length ? Math.max(...t) : 0,
							r = e.map(e => e.nameIndex),
							i = r.length ? Math.max(...r) : 0
						this.maxNameIndex = Math.max(s, i)
					}
					if (
						(this.meshTrimsById.atomic(() => {
							this.meshTrimsByFloorIndex.atomic(() => {
								for (const r of e) {
									this.meshTrimsByFloorIndex.has(`${r.floorIndex}`) ||
										this.meshTrimsByFloorIndex.set(`${r.floorIndex}`, new i.d())
									const e = this.meshTrimsByFloorIndex.get(`${r.floorIndex}`)
									e.length < o.t
										? (-1 === r.nameIndex && ((r.nameIndex = this.maxNameIndex + 1), (this.maxNameIndex = r.nameIndex)),
										  e.push(r),
										  this.meshTrimsById.set(r.id, r),
										  t.add(r.floorIndex))
										: (d.debugWarn("Trims exceed floor limit (trimId, floorIndex):", r.id, r.floorIndex), (s = !0))
								}
							})
						}),
						t.forEach(e => {
							const t = this.meshTrimsByFloorIndex.get(`${e}`)
							this.sortList(t), this.reassignIndexes(t)
						}),
						(this.numberOfTrims = this.meshTrimsById.length),
						this.commit(),
						s)
					)
						throw new h.M("Exceeding max trims")
				}
				delete(...e) {
					const t = new Set()
					this.meshTrimsByFloorIndex.atomic(() => {
						for (const s of e) {
							const e = this.meshTrimsByFloorIndex.get(`${s.floorIndex}`),
								r = e.indexOf(s)
							if (r >= 0) {
								;(e.splice(r, 1)[0].enabled = !1),
									t.add(s.floorIndex),
									s.nameIndex === this.maxNameIndex && this.maxNameIndex--
							} else d.error("Could not delete mesh trim:" + s.id)
						}
					}),
						t.forEach(e => {
							const t = this.meshTrimsByFloorIndex.get(`${e}`)
							this.reassignIndexes(t)
						}),
						this.meshTrimsById.atomic(() => {
							e.forEach(e => {
								this.meshTrimsById.delete(e.id)
							})
						}),
						e.length > 1 && (this.maxNameIndex = -1),
						(this.numberOfTrims = this.meshTrimsById.length),
						this.commit()
				}
				getTrimById(e) {
					return this.meshTrimsById.get(e)
				}
				getTrim(e, t) {
					return this.meshTrimsByFloorIndex.has(`${e}`) ? this.meshTrimsByFloorIndex.get(`${e}`).get(t) : null
				}
				getTrimsForFloor(e) {
					return this.meshTrimsByFloorIndex.has(`${e}`) ? this.meshTrimsByFloorIndex.get(`${e}`).values() : []
				}
				reassignIndexes(e) {
					e.forEach((e, t) => {
						e.index = t
					})
				}
				sortList(e) {
					e.sort((e, t) => e.index - t.index)
				}
			}
		},
		28719: (e, t, s) => {
			"use strict"
			s.d(t, { M: () => TooManyTrimsError })
			var r = s(31102)
			class TooManyTrimsError extends r.y {
				constructor(e) {
					super(e), (this.name = "TooManyTrimsError")
				}
			}
		},
		8511: (e, t, s) => {
			"use strict"
			s.d(t, { z: () => Chunk })
			var r = s(2212),
				i = s(56247),
				a = s(67078)
			class ChunkMaterial extends a.b {
				constructor(e, t, s) {
					const r = {}
					for (const e of t) r[e] = !0
					super({
						extensions: { derivatives: !0 },
						fragmentShader: i.Z.modelChunk.fragmentShader,
						vertexShader: i.Z.modelChunk.vertexShader,
						uniforms: s,
						name: e,
						defines: r
					}),
						(this.capabilities = t)
				}
			}
			var o = s(22377),
				n = s(19131),
				h = s(10757),
				d = s(2388),
				l = s(44283),
				u = s(17916),
				c = s(75351)
			let m,
				g = 1
			try {
				m = (0, n.k7)(0, 0)
			} catch (e) {}
			const p = [
					{
						key: o.h.PanoTextureTransition,
						enabled: function (e) {
							return e.progress.value > 0 && e.progress.value < 1 && e.pano0Map.value !== e.pano1Map.value
						},
						dependsOn: [o.h.PanoTexture],
						uniformsUsed: ["progress", "pano0Map", "pano1Map"]
					},
					{
						key: o.h.PanoTexture,
						enabled: function (e) {
							return e.panoOpacity.value > 0
						},
						dependsOn: [],
						uniformsUsed: ["panoOpacity"]
					},
					{
						key: o.h.ColorOverlay,
						enabled: function (e) {
							return null !== e.colorOverlay.value
						},
						dependsOn: [],
						uniformsUsed: ["colorOverlay"]
					},
					{
						key: o.h.MeshPreviewSphere,
						enabled: function (e) {
							return null !== e.meshPreviewCenter.value
						},
						dependsOn: [o.h.MeshTexture],
						uniformsUsed: []
					},
					{
						key: o.h.MeshTexture,
						enabled: function (e) {
							return e.meshOpacity.value > 0 && e.map.value
						},
						dependsOn: [],
						uniformsUsed: ["meshOpacity", "map"]
					},
					{
						key: o.h.Wireframe,
						enabled: function (e) {
							return !1
						},
						dependsOn: [],
						uniformsUsed: []
					},
					{
						key: o.h.FlatShading,
						enabled: function (e) {
							return !1
						},
						dependsOn: [],
						uniformsUsed: []
					},
					{
						key: o.h.PanoOverlay,
						enabled: function (e) {
							return !!e.overlay0Map.value
						},
						dependsOn: [o.h.PanoTexture],
						uniformsUsed: ["overlay0Map"]
					},
					{
						key: o.h.PanoOverlayTransition,
						enabled: function (e) {
							return !!(
								e.progress.value > 0 &&
								e.progress.value < 1 &&
								e.overlay0Map.value &&
								e.overlay1Map.value &&
								e.overlay0Map.value !== e.overlay1Map.value
							)
						},
						dependsOn: [o.h.PanoOverlay, o.h.PanoTexture, o.h.PanoTextureTransition],
						uniformsUsed: ["progress", "overlay0Map", "overlay1Map"]
					},
					{
						key: o.h.MeshTrim,
						enabled: function (e) {
							return e.meshTrimsEnabled.value.some(e => e)
						},
						dependsOn: [o.h.MeshTexture],
						uniformsUsed: ["meshTrimPositions"]
					}
				],
				f = new Set(p.map(e => e.uniformsUsed).reduce((e, t) => e.concat(t), []))
			class Chunk {
				constructor(e, t, s, a = "") {
					;(this.meshGroup = e),
						(this.meshSubgroup = t),
						(this.geometry = s),
						(this.textureName = a),
						(this.id = g++),
						(this.name = ""),
						(this.lod = u.V.Standard),
						(this.renderingMode = c.S.Standard),
						(this.chunkMaterials = {}),
						(this.modeMaterials = {}),
						(this.capabilityOverrides = {}),
						(this.onMaterialUpdate = new Set()),
						(this.uniformCache = this.getUniformDefaults()),
						(this.temp = {
							m1: new r.Matrix4(),
							m2: new r.Matrix4(),
							quat: new r.Quaternion()
						}),
						(this.modeMaterials[c.S.Standard] = this.getChunkMaterial(this.getCapabilities())),
						(this._material = this.modeMaterials[c.S.Standard])
					const o = r.UniformsUtils.clone(i.Z.depth.uniforms)
					this.modeMaterials[c.S.Depth] = new r.RawShaderMaterial({
						fragmentShader: i.Z.depth.fragmentShader,
						vertexShader: i.Z.depth.vertexShader,
						uniforms: o,
						side: r.FrontSide,
						name: "materialDepth"
					})
					const n = r.UniformsUtils.clone(i.Z.modelOutside.uniforms)
					;(n.opacity.value = 0.2),
						(this.modeMaterials[c.S.Transparent] = new r.RawShaderMaterial({
							fragmentShader: i.Z.modelOutside.fragmentShader,
							vertexShader: i.Z.modelOutside.vertexShader,
							uniforms: n,
							side: r.FrontSide,
							transparent: !0,
							name: "materialTransparent"
						}))
					const h = r.UniformsUtils.clone(i.Z.modelOutside.uniforms)
					;(h.opacity.value = 0.5),
						h.colorOverlay.value.set(1, 1, 1, 1),
						(this.modeMaterials[c.S.Wireframe] = new r.RawShaderMaterial({
							fragmentShader: i.Z.modelOutside.fragmentShader,
							vertexShader: i.Z.modelOutside.vertexShader,
							uniforms: h,
							side: r.FrontSide,
							transparent: !0,
							wireframe: !0,
							name: "materialWireframe"
						}))
				}
				getUniformDefaults() {
					const e = {}
					for (const t in i.Z.modelChunk.uniforms) {
						const s = r.UniformsUtils.clone(i.Z.modelChunk.uniforms[t])
						for (const t in s) e[t] = s[t]
					}
					return e
				}
				set material(e) {
					if (this._material !== e && this.onMaterialUpdate) for (const t of this.onMaterialUpdate.values()) t(e)
					this._material = e
				}
				get material() {
					return this._material
				}
				notifyOnMaterialUpdated(e) {
					return (0, l.k1)(
						() => this.onMaterialUpdate.add(e),
						() => this.onMaterialUpdate.delete(e),
						!0
					)
				}
				setMeshTexture(e) {
					this.setMaterialsUniform({ map: e })
				}
				getColorOverlay() {
					return this._colorOverlay
				}
				setColorOverlay(e) {
					this._colorOverlay !== e && (this.setMaterialsUniform({ colorOverlay: e }), (this._colorOverlay = e))
				}
				setMeshTextureOpacity(e) {
					e !== this._meshTextureOpacity &&
						(this.setMaterialsUniform({ meshOpacity: e, panoOpacity: 1 - e }), (this._meshTextureOpacity = e))
				}
				setProgress(e) {
					this._progress !== e && (this.setMaterialsUniform({ progress: e }), (this._progress = e))
				}
				setOpacity(e) {
					;(this.material.opacity = e),
						(this.material.transparent = e < d.xx.FADE_OPAQUE),
						(this.material.depthWrite = e >= d.xx.FADE_DEPTH_WRITE_THRESHOLD),
						this.onOpacityUpdate && this.onOpacityUpdate(e)
				}
				setTime(e) {
					this.renderingMode === c.S.Wireframe && this.setMaterialsUniform({ time: e })
				}
				setTransparentDiscard(e) {
					this.setMaterialsUniform({ transparentDiscardDist: e })
				}
				setMeshPreviewSphere(e, t = 0.3) {
					this.setMaterialsUniform({
						meshPreviewCenter: e,
						meshPreviewSize: t
					})
				}
				setWireframe(e) {
					if (e) {
						if (this.geometry.getIndex()) {
							const e = this.geometry
							e.boundsTree && (e.boundsTree.geometry = this.geometry.clone()),
								this.geometry.copy(this.geometry.toNonIndexed())
						}
						;(0, n.ko)(this.geometry)
					}
					this.overrideCapability(o.h.Wireframe, e)
				}
				setFlatShading(e) {
					e && this.geometry.computeVertexNormals(), this.overrideCapability(o.h.FlatShading, e)
				}
				getCapabilities() {
					const e = new Set()
					for (const t in this.capabilityOverrides) this.capabilityOverrides[t] && e.add(t)
					for (const t of p)
						if (!e.has(t.key) && t.enabled(this.uniformCache)) {
							e.add(t.key)
							for (const s of t.dependsOn) e.add(s)
						}
					return e
				}
				overrideCapability(e, t) {
					;(this.capabilityOverrides[e] = t), this.updateMaterialCapabilities()
				}
				updateMaterialCapabilities() {
					const e = this.getCapabilities(),
						t = this.modeMaterials[c.S.Standard]
					if ((0, h.TH)(t.capabilities, e)) return this._material
					const s = this.getChunkMaterial(e)
					return (
						(s.side = t.side),
						(s.transparent = t.transparent),
						(s.depthWrite = t.depthWrite),
						(this.modeMaterials[c.S.Standard] = s),
						this.renderingMode === c.S.Standard && (this.material = s),
						this._material
					)
				}
				getChunkMaterial(e) {
					let t = "chunkMaterial_"
					for (const s of p) t += e.has(s.key) ? "1" : "0"
					return (
						this.chunkMaterials[t] ||
							(this.chunkMaterials[t] = new ChunkMaterial(t, e, this.getUniformsForCapabilities(e))),
						this.chunkMaterials[t]
					)
				}
				getUniformsForCapabilities(e) {
					const t = {}
					for (const s of e) {
						const e = i.Z.modelChunk.uniforms[s]
						for (const s in e) t[s] = this.uniformCache[s]
					}
					return t
				}
				getCurrentUniformValues(e) {
					for (const t of Object.keys(this.uniformCache)) e[t] = this.uniformCache[t].value
				}
				setMaterialsUniform(e) {
					let t,
						s = !1
					const r = this.uniformCache.meshPreviewCenter.value
					for (const i in e) {
						let a = !1
						const o = e[i]
						if (
							((a = "meshPreviewCenter" !== i ? a || f.has(i) : a || (null === r) != (null === o)),
							!(i in this.uniformCache))
						)
							throw new Error(`Uniform ${i} does not exist in Chunk`)
						const n = this.uniformCache[i]
						n.value !== o &&
							(o && (o.isVector3 || o.isVector4 || o.isMatrix3 || o.isMatrix4 || o.isColor)
								? null === n.value
									? (n.value = o.clone())
									: n.value.copy(o)
								: (n.value = o),
							(s = s || a),
							"opacity" === i && (t = o))
					}
					return s && this.updateMaterialCapabilities(), void 0 !== t && this.setOpacity(t), this._material
				}
				setRenderingMode(e) {
					;(this.renderingMode = e), (this.material = this.modeMaterials[e])
				}
				setSide(e) {
					for (const t in this.chunkMaterials) this.chunkMaterials[t].side = e
				}
				forEachMaterial(e) {
					for (const t in this.chunkMaterials) e(this.chunkMaterials[t])
				}
				setProjectedPano(e, t, s, r) {
					let i = 1 === e ? "pano1Map" : "pano0Map"
					const a = {}
					;(a[i] = r || m),
						t && ((i = 1 === e ? "pano1Position" : "pano0Position"), (a[i] = t)),
						s &&
							t &&
							((i = 1 === e ? "pano1Matrix" : "pano0Matrix"),
							this.temp.m1.makeRotationFromQuaternion(this.temp.quat.copy(s).invert()),
							this.temp.m2.makeScale(-1, 1, 1),
							(a[`${i}1`] = this.temp.m1),
							(a[`${i}2`] = this.temp.m2)),
						this.setMaterialsUniform(a)
				}
				setOverlayPano(e, t, s) {
					const i = `overlay${e}`,
						a = {}
					if (t) {
						const e = new r.Matrix4().makeRotationFromQuaternion(t)
						a[i + "Matrix"] = e
					}
					;(a[i + "Map"] = s || m), this.setMaterialsUniform(a)
				}
			}
		},
		62955: (e, t, s) => {
			"use strict"
			s.d(t, { e: () => ModelMeshBase })
			var r = s(2212)
			class ModelMeshBase extends r.Object3D {
				constructor() {
					super(...arguments),
						(this.boundingBox = new r.Box3()),
						(this.size = new r.Vector3()),
						(this.center = new r.Vector3()),
						(this._chunks = [])
				}
				get chunks() {
					return this._chunks
				}
			}
		},
		32653: (e, t, s) => {
			"use strict"
			s.d(t, { s: () => RoomMeshData })
			var r = s(32770)
			class RoomMeshData extends r.V {
				constructor() {
					super(), (this.name = "room-mesh-data"), (this.floors = new Set()), (this.rooms = new Set())
				}
			}
		},
		41659: (e, t, s) => {
			"use strict"
			s.d(t, { u: () => SetMeshOverlayCommand })
			var r,
				i,
				a = s(17386)
			!(function (e) {
				;(e.all = "all"),
					(e.byFloorId = "byFloorId"),
					(e.byRoomId = "byRoomId"),
					(e.byMeshGroup = "byMeshGroup"),
					(e.byMeshSubGroup = "byMeshSubGroup")
			})(r || (r = {})),
				(function (e) {
					;(e.explicit = "explicit"), (e.random = "random")
				})(i || (i = {}))
			class SetMeshOverlayCommand extends a.m {
				constructor(e, t) {
					super(),
						(this.id = "SET_MESH_OVERLAY_COLOR"),
						(this.payload = {
							selectBy: (null == t ? void 0 : t.style) || r.all,
							colorStyle: (null == e ? void 0 : e.style) || i.explicit,
							color: (null == e ? void 0 : e.color) || null,
							alpha: (null == e ? void 0 : e.alpha) || 0.5,
							id: null == t ? void 0 : t.id,
							index: null == t ? void 0 : t.index
						})
				}
			}
			;(SetMeshOverlayCommand.selectBy = r),
				(SetMeshOverlayCommand.colorBy = i),
				(SetMeshOverlayCommand.COLOR_DIM = { x: 0, y: 0, z: 0, w: 0.3 })
		},
		81638: (e, t, s) => {
			"use strict"
			s.d(t, { I: () => ToggleMeshOverlayColorCommand })
			var r = s(17386)
			class ToggleMeshOverlayColorCommand extends r.m {
				constructor(e) {
					super(), (this.id = "TOGGLE_MESH_OVERLAY_COLOR"), (this.payload = { enabled: e })
				}
			}
		},
		28745: (e, t, s) => {
			"use strict"
			s.r(t), s.d(t, { default: () => ModelMeshModule })
			var r = s(47724),
				i = s(96909),
				a = s(72067),
				o = s(98828),
				n = s(21479),
				h = s(12216),
				d = s(59088),
				l = s(26059),
				u = s(46114),
				c = s(44218),
				m = s(8445),
				g = s(17399),
				p = s(32306),
				f = s(29397),
				y = s(51764),
				x = s(85895),
				M = s(75892),
				w = s(33512),
				T = s(64807),
				S = s(91302),
				b = s(68576),
				v = s(88814),
				k = s(35597),
				C = s(94329),
				O = s(79437),
				B = s(2212),
				F = s(864)
			let I = !1
			var D = s(81638),
				P = s(59167),
				R = s(80301),
				_ = s(67027),
				z = s(56247)
			const U = {
				meshTrimPositions: [],
				meshTrimScales: [],
				meshTrimsEnabled: []
			}
			function E() {
				return Object.assign({}, U)
			}
			class MeshTrimUniforms {
				constructor() {
					this.floorUniforms = {}
				}
				setMeshTrim(e) {
					const { enabled: t, floorIndex: s, index: r, position: i, scale: a } = e,
						o = E()
					return (
						(o.meshTrimPositions = this.setMeshTrimPosition(s, r, i)),
						(o.meshTrimScales = this.setMeshTrimScale(s, r, a)),
						(o.meshTrimsEnabled = this.setMeshTrimEnabled(s, r, t)),
						(this.floorUniforms[s] = o),
						o
					)
				}
				updateMeshTrimArrays(e, t) {
					const s = E(),
						r = this.getFloorUniforms(e).meshTrimPositions.slice(),
						i = this.getFloorUniforms(e).meshTrimScales.slice(),
						a = this.getFloorUniforms(e).meshTrimsEnabled.slice()
					for (let e = 0; e < t.length; e++) {
						const s = !(e >= t.length) && t[e].enabled
						;(r[e] = t[e].position), (i[e] = t[e].scale), a.push(s)
					}
					for (let e = t.length; e < z.t; e++) (r[e] = new B.Vector3()), (i[e] = new B.Vector3()), a.push(!1)
					return (
						(s.meshTrimPositions = r), (s.meshTrimScales = i), (s.meshTrimsEnabled = a), (this.floorUniforms[e] = s), s
					)
				}
				setMeshTrimPosition(e, t, s) {
					const r = this.getFloorUniforms(e).meshTrimPositions.slice()
					return (r[t] = s), r
				}
				setMeshTrimScale(e, t, s) {
					const r = this.getFloorUniforms(e).meshTrimScales.slice()
					return (r[t] = s), r
				}
				setMeshTrimEnabled(e, t, s) {
					const r = this.getFloorUniforms(e).meshTrimsEnabled.slice()
					return (r[t] = s), r
				}
				getFloorUniforms(e) {
					return this.floorUniforms[`${e}`] || E()
				}
			}
			class MeshOverlayColor {
				constructor(e) {
					;(this.getChunks = e),
						(this.TOOL_MESH_COLOR_OVERLAY = new B.Vector4(0, 0, 0, 0.3)),
						(this.enabled = null),
						(this.toggleEnabled = e => {
							if (e !== this.enabled) {
								for (const t of this.getChunks()) t.setColorOverlay(e ? this.TOOL_MESH_COLOR_OVERLAY : null)
								this.enabled = e
							}
						})
				}
			}
			var A = s(10757),
				V = s(55356),
				L = s(88512),
				Q = s(33874),
				G = s(24930),
				N = s(2388),
				q = s(75351),
				$ = s(22377),
				Z = s(48358),
				W = s(8511)
			const j = new B.Vector3(0, 0, 0),
				H = new B.Vector3(100, 100, 100),
				Y = new B.Vector3(),
				X = new B.Vector3(),
				J = new B.Box3()
			class FallbackMesh extends B.Mesh {
				constructor() {
					super(),
						(this.bounds = new B.Box3()),
						(this.geometry = new B.BoxBufferGeometry(1, 1, 1)),
						this.geometry.computeBoundingBox(),
						this.geometry.computeBoundingSphere(),
						(this.chunk = new W.z(-1, -1, this.geometry))
					const e = e => {
						;(this.material = e),
							(this.material.side = B.BackSide),
							(this.material.transparent = !0),
							(this.material.depthWrite = !1)
					}
					this.chunk.notifyOnMaterialUpdated(e),
						e(this.chunk.material),
						(this.name = "FallbackMesh"),
						(this.renderOrder = Z.z.boundingSkybox),
						this.setFromCenterAndSize(j, H)
				}
				setBounds(e) {
					if (this.bounds.equals(e)) return
					this.bounds.copy(e)
					const t = e.getSize(Y)
					this.position.copy(e.getCenter(X)), this.scale.set(t.x, t.y, t.z), this.updateMatrixWorld(!0)
				}
				setFromCenterAndSize(e, t = H) {
					this.setBounds(J.setFromCenterAndSize(e, t))
				}
			}
			var K = s(41659),
				ee = s(91670),
				te = s(17386)
			class SetPanoOverlayCommand extends te.m {
				constructor(e, t, s) {
					super(), (this.id = "SET_PANO_OVERLAY"), (this.payload = { sweepId: e, texture: t, quaternion: s })
				}
			}
			var se = s(8482)
			const re = new L.Z("modelrenderer")
			class ModelRenderer {
				constructor(e, t, s, r, i, a, o, n) {
					;(this.scene = e),
						(this.container = t),
						(this.mesh = s),
						(this.panoRenderer = r),
						(this.meshData = i),
						(this.sweepData = a),
						(this.applicationData = o),
						(this.renderOptions = n),
						(this.chunkRenderingModeOverride = null),
						(this.lastChunkRenderingModeOverride = null),
						(this.fallbackMesh = new FallbackMesh()),
						(this.overlayTextures = [
							{
								sweepId: void 0,
								texture: void 0,
								renderTarget: new B.WebGLCubeRenderTarget(2048, {
									format: B.RGBAFormat
								}),
								quaternion: new B.Quaternion()
							},
							{
								sweepId: void 0,
								texture: void 0,
								renderTarget: new B.WebGLCubeRenderTarget(2048, {
									format: B.RGBAFormat
								}),
								quaternion: new B.Quaternion()
							}
						]),
						(this.overlayEnabled = !1),
						(this.bindings = []),
						(this.updateFallbackMesh = (() => {
							const e = new B.Box3()
							return () => {
								if (this.sweepData.currentAlignedSweepObject && this.viewmodeData.isInside()) {
									const t = e.copy(this.meshData.bounds).expandByScalar(0.2)
									this.fallbackMesh.setBounds(t)
								} else this.cameraData && this.fallbackMesh.setFromCenterAndSize(this.cameraData.pose.position)
							}
						})()),
						(this.debugColorizeChunks = (() => {
							let e = !1
							return (t, s) => {
								const r = new B.Vector4(1, 1, 1, 0)
								;(e = !e),
									(e => {
										for (const t of this.mesh.chunks) {
											const i = s ? 100 * t.id : 100 * t.meshSubgroup,
												a = e ? (0, V.G1)(0.5, i) : r
											t.setColorOverlay(a)
										}
									})(t || e)
							}
						})())
				}
				init() {}
				dispose() {}
				async activate(e) {
					;(this.engine = e),
						([this.viewmodeData, this.settings, this.cameraData, this.renderer] = await Promise.all([
							e.market.waitForData(k.O),
							e.market.waitForData(Q.e),
							e.market.waitForData(d.M_),
							e.getModuleBySymbol(i.y.WEBGL_RENDERER)
						])),
						this.scene.add(this.container),
						this.scene.add(this.fallbackMesh),
						(this.fallbackMesh.layers.mask = this.container.layers.mask),
						this.updateRenderState(),
						this.bindings.push(
							this.viewmodeData.onChanged(this.updateRenderState.bind(this)),
							this.sweepData.onChanged(this.updateRenderState.bind(this)),
							this.settings.onChanged(this.updateRenderState.bind(this)),
							e.commandBinder.addBinding(K.u, this.onMeshOverlayCommand.bind(this)),
							e.commandBinder.addBinding(ee.U, this.onSetChunkRenderStateCommand.bind(this)),
							e.commandBinder.addBinding(SetPanoOverlayCommand, this.onPanoOverlayCommand.bind(this))
						),
						this.renderOptions.colorizeRooms && this.debugColorizeChunks(!0),
						this.renderOptions.colorizeChunks && this.debugColorizeChunks(!0, !0),
						this.renderOptions.wireframe && this.toggleWireframe(!0),
						this.setupDebugMenu(e)
				}
				deactivate() {
					for (const e of this.bindings) e.cancel()
					;(this.bindings = []),
						this.scene.remove(this.container),
						this.scene.remove(this.fallbackMesh),
						this.currentSweepId && this.panoRenderer.freeTexture(this.currentSweepId),
						(this.currentSweepId = null),
						(this.targetSweepId = null)
				}
				updateSweepRenderTarget(e, t, s, r) {
					const i = this.panoRenderer.useTexture(t)
					if (i) for (const t of this.allChunks()) t.setProjectedPano(e, s, r, i)
				}
				*allChunks() {
					yield* this.mesh.chunks, yield this.fallbackMesh.chunk
				}
				updateExistingTexture(e, t, s, r) {
					for (const i of this.allChunks())
						e === this.currentSweepId && i.setProjectedPano(0, s, r, t),
							e === this.targetSweepId && i.setProjectedPano(1, s, r, t)
				}
				render() {}
				beforeRender() {
					const e = !this.displayingUnaligned(this.sweepData, this.viewmodeData)
					this.container.visible = e
					const { floorOpacity: t, roomFadeDist: s } = this.meshData.meshGroupVisuals
					for (const e of this.mesh.chunks) {
						const r = t.get(e.meshGroup) || 0
						let i = (0, se.t)(e.material.opacity, r, 0.2)
						Math.abs(i - r) < 1e-4 && (i = r),
							e.setMaterialsUniform({
								meshOpacity: this.meshData.meshTextureOpacity.value,
								panoOpacity: 1 - this.meshData.meshTextureOpacity.value,
								opacity: i,
								transparentDiscardDist: s.get(e.meshGroup, e.meshSubgroup) || 0,
								progress: this.sweepData.transition.progress.value
							})
					}
					const r = (0, O.w2)(this.meshData.meshTextureOpacity.value, 0, 1, 1)
					this.fallbackMesh.chunk.setMeshTextureOpacity(r),
						this.fallbackMesh.chunk.setProgress(this.sweepData.transition.progress.value),
						this.updateFallbackMesh()
				}
				displayingUnaligned(e, t) {
					return t.closestMode === C.Ey.Panorama && !!e.currentSweep && e.isSweepUnaligned(e.currentSweep)
				}
				updateChunkMaterialMode(e, t) {
					const s = t || q.S.Standard,
						r = e ? B.DoubleSide : B.FrontSide
					for (const e of this.mesh.chunks) e.setRenderingMode(s), e.setSide(r)
				}
				updateRenderState() {
					if (
						((this.container.visible = this.settings.tryGetProperty(N.AN, !0)),
						this.viewmodeData.currentMode !== this.lastViewmode ||
							this.lastChunkRenderingModeOverride !== this.chunkRenderingModeOverride)
					) {
						this.lastChunkRenderingModeOverride = this.chunkRenderingModeOverride
						const e = this.viewmodeData.isInside()
						this.updateChunkMaterialMode(e, this.chunkRenderingModeOverride),
							(this.lastViewmode = this.viewmodeData.currentMode)
					}
					if (
						(this.viewmodeData.transition.active && (0, C.Bw)(this.viewmodeData.transition.to)) ||
						this.viewmodeData.isInside()
					) {
						const e = this.sweepData.currentSweep,
							t = this.sweepData.transition,
							s =
								t.active &&
								(this.applicationData.phase === n.nh.PLAYING || this.applicationData.phase === n.nh.STARTING),
							r = s ? t.from : e,
							i = s ? t.to : e,
							a = this.currentSweepId,
							o = this.targetSweepId
						;(this.currentSweepId = r || null),
							(this.targetSweepId = i || null),
							this.handleSweepChange(0, a, this.currentSweepId),
							this.handleSweepChange(1, o, this.targetSweepId)
					}
					if (this.overlayEnabled) {
						const e = this.overlayTextures.find(e => e.sweepId === this.currentSweepId),
							t = this.overlayTextures.find(e => e.sweepId === this.targetSweepId)
						for (const s of this.allChunks())
							s.setOverlayPano(0, e ? e.quaternion : void 0, e ? e.texture : void 0),
								s.setOverlayPano(1, t ? t.quaternion : void 0, t ? t.texture : void 0)
					}
				}
				handleSweepChange(e, t, s) {
					if (t !== s && (t && this.panoRenderer.freeTexture(t), s)) {
						const t = this.sweepData.getSweep(s)
						this.updateSweepRenderTarget(e, s, t.position, t.rotation)
					}
				}
				async onPanoOverlayCommand(e) {
					this.overlayEnabled = !0
					const t = t => {
						const s = t.renderTarget
						;(t.renderTarget.width = e.texture.image.width),
							(t.renderTarget.height = e.texture.image.height),
							(t.sweepId = e.sweepId),
							(t.texture = s.texture),
							(t.quaternion = e.quaternion),
							this.renderer.cwfRenderer.copyCubemap(e.texture, t.renderTarget)
					}
					let s = !1
					for (const r of this.overlayTextures) s || r.sweepId !== e.sweepId || (t(r), (s = !0))
					for (const e of this.overlayTextures)
						s || e.sweepId === this.targetSweepId || e.sweepId === this.currentSweepId || (t(e), (s = !0))
					this.updateRenderState()
				}
				async onMeshOverlayCommand(e) {
					const t = this.meshData.meshGroups.rooms,
						s = this.meshData.meshGroups.roomIds,
						r = this.meshData.meshGroups.floors,
						i = this.meshData.meshGroups.floorIds
					let a
					switch (e.selectBy) {
						case K.u.selectBy.all:
							a = () => !0
							break
						case K.u.selectBy.byFloorId:
							a = t => {
								let s = !1
								for (const a of r) t.meshGroup === a.meshGroup && i[t.meshGroup] === e.id && (s = !0)
								return s
							}
							break
						case K.u.selectBy.byRoomId:
							a = r => {
								let i = !1
								for (const { meshSubgroup: a, meshGroup: o } of t)
									r.meshSubgroup === a && r.meshGroup === o && s.get(r.meshGroup, r.meshSubgroup) === e.id && (i = !0)
								return i
							}
							break
						case K.u.selectBy.byMeshGroup:
							a = t => t.meshGroup === e.index
							break
						case K.u.selectBy.byMeshSubGroup:
							a = t => t.meshSubgroup === e.index
					}
					if (!a) return
					let o = "rand"
					e.colorStyle === K.u.colorBy.explicit &&
						(o = e.color ? new B.Vector4(e.color.x, e.color.y, e.color.z, e.color.w) : null)
					for (const t of this.mesh.chunks) a(t) && t.setColorOverlay("rand" === o ? (0, V.G1)(e.alpha) : o)
				}
				async onSetChunkRenderStateCommand(e) {
					;(this.chunkRenderingModeOverride = e.mode), this.updateRenderState()
				}
				toggleWireframe(e) {
					for (const t of this.mesh.chunks) t.setWireframe(e)
				}
				async setupDebugMenu(e) {
					const [t, s] = await Promise.all([e.market.waitForData(Q.e), e.getModule(G.default)])
					s.registerButton("Mesh", "Toggle visible", () => {
						this.container.visible = !this.container.visible
					}),
						s.registerButton("Mesh", "Toggle depth", () => {
							const t = this.chunkRenderingModeOverride ? null : q.S.Depth
							e.commandBinder.issueCommand(new ee.U(t))
						}),
						s.registerButton("Mesh", "Toggle transparent", () => {
							const t = this.chunkRenderingModeOverride ? null : q.S.Transparent
							e.commandBinder.issueCommand(new ee.U(t))
						}),
						s.registerButton("Mesh", "Toggle wireframe", () => {
							const t = this.chunkRenderingModeOverride ? null : q.S.Wireframe
							e.commandBinder.issueCommand(new ee.U(t))
						})
					let r = !1
					s.registerButton("Mesh", "Toggle flat shading", () => {
						r = !r
						for (const e of this.mesh.chunks) e.setFlatShading(r)
					}),
						s.registerButton("Mesh", "Cycle all chunk materials", () => {
							this.debugCycleChunkMaterials()
						}),
						s.registerButton("Mesh", "Highlight Rooms", this.debugColorizeChunks),
						s.registerButton("Mesh", "Highlight Chunks", () => this.debugColorizeChunks(!0, !0))
					const i = (e, r, i, a, o) => {
						s.registerSetting(e, r, i, !0, G.SettingPersistence.NONE, o), t.onPropertyChanged(r, a)
					}
					i("Wireframe", N.Lp, !1, this.toggleWireframe.bind(this))
					const a = {
						[$.h.Wireframe]: {
							Wireframe: [
								"thickness",
								"wireframeOpacity",
								"stroke",
								"fillEnabled",
								"fill",
								"insideAltColor",
								"dualStroke",
								"secondThickness"
							],
							"Wireframe Dashes": ["dashEnabled", "dashLength", "dashAnimate", "dashOverlap"],
							"Wireframe Advanced": ["squeeze", "squeezeMin", "squeezeMax"]
						}
					}
					for (const e in a) {
						const t = z.Z.modelChunk.uniforms[e]
						for (const s in a[e])
							for (const r of a[e][s])
								i(
									s,
									r,
									t[r].value,
									e => {
										for (const t of this.mesh.chunks) t.setMaterialsUniform({ [r]: e })
									},
									t[r].range
								)
					}
				}
				async debugCycleChunkMaterials() {
					const e = []
					for (const t in $.h) isNaN(Number(t)) && e.push($.h[t])
					const t = []
					for (const e in q.S) isNaN(Number(e)) && t.push(q.S[e])
					re.info(`Available ChunkMaterialCapabilities: ${e}`)
					const s = []
					for (let t = 0; t < 1 << (e.length - 1); t++) {
						const r = {}
						for (let s = e.length - 1; s >= 0; s--) {
							r[e[s]] = Boolean(t & (1 << s))
						}
						s.push(r)
					}
					re.info(`There are ${s.length * t.length} options to test`)
					for (let e = 0; e < t.length; e++) {
						await this.engine.commandBinder.issueCommand(new ee.U(e))
						for (const t of s) {
							re.info(`Testing ChunkRenderingMode.${q.S[e]} with capabilities: ${JSON.stringify(t, void 0, 2)}`)
							const s = new B.Vector4(Math.random(), Math.random(), Math.random(), 0.5)
							for (const e of Object.keys(t))
								for (const r of this.mesh.chunks)
									r.setColorOverlay(s), r.setMeshPreviewSphere(new B.Vector3(0, 0, 0)), r.overrideCapability(e, t[e])
							await (0, A.gw)(100)
						}
						await (0, A.gw)(100)
					}
					await this.engine.commandBinder.issueCommand(new ee.U(null))
				}
			}
			var ie = s(20331)
			class MeshRenderPass {
				constructor(e, t, s = 128, r = 128) {
					;(this.slots = e),
						(this.renderToTextureModule = t),
						(this.width = s),
						(this.height = r),
						(this.sizeMultiplier = 1 / 8),
						(this.pixelBuffer = new Uint8Array(4)),
						(this.readBuffer = null),
						(this.readPixelsAsync = Promise.resolve(this.pixelBuffer))
				}
				get renderTarget() {
					return (
						this._renderTarget ||
							(this._renderTarget = new B.WebGLRenderTarget(this.width, this.height, {
								type: B.UnsignedByteType,
								format: B.RGBAFormat,
								depthBuffer: !1,
								stencilBuffer: !1,
								generateMipmaps: !1,
								minFilter: B.NearestFilter,
								magFilter: B.NearestFilter
							})),
						this._renderTarget
					)
				}
				pixels() {
					return this.pixelBuffer
				}
				renderAndReadAsync(e, t) {
					this.beforeRender(),
						this.updateReadBufferSize(),
						(this.readPixelsAsync = this.renderToTextureModule
							.renderAndReadAsync(
								{ mesh: e, camera: t, target: this.renderTarget, clear: !0 },
								{ x: 0, y: 0, width: this.width, height: this.height },
								{ buffer: this.pixelBuffer }
							)
							.then(e => ((this.pixelBuffer = e), this.pixelBuffer))),
						this.afterRender()
				}
				render(e, t, s = !1, r = !0) {
					this.beforeRender()
					let { width: i, height: a } = this.renderToTextureModule.getRenderSize()
					;(i = Math.max(1, Math.floor(i * this.sizeMultiplier))),
						(a = Math.max(1, Math.floor(a * this.sizeMultiplier))),
						(i === this.renderTarget.width && a === this.renderTarget.height) || this.renderTarget.setSize(i, a),
						this.renderToTextureModule.render(this.renderTarget, e, t),
						s && this.renderToScreen(),
						r && this.afterRender()
				}
				renderToScreen() {
					this.renderToTextureModule.renderToScreen(this.renderTarget, !1)
				}
				readPixels() {
					this.updateReadBufferSize()
					const e = this.pixelBuffer
					return (
						(this.pixelBuffer = this.renderToTextureModule.getRenderTargetData(this.renderTarget, e)), this.pixelBuffer
					)
				}
				updateReadBufferSize() {
					const e = this.renderTarget.width * this.renderTarget.height * 4
					this.pixelBuffer.length !== e && (this.pixelBuffer = new Uint8Array(e))
				}
				beforeRender() {
					;(this.width === this.renderTarget.width && this.height === this.renderTarget.height) ||
						this.renderTarget.setSize(this.width, this.height)
					for (const e of this.slots) for (const t of e.chunks) this.beforeRenderChunk(t, e)
				}
				afterRender() {
					for (const e of this.slots) for (const t of e.chunks) this.afterRenderChunk(t, e)
				}
			}
			class TextureQualityRenderPass extends MeshRenderPass {
				constructor() {
					super(...arguments), (this.prevColor = new WeakMap())
				}
				beforeRenderChunk(e, t) {
					t.quality in t.config &&
						(this.prevColor.set(t, e.getColorOverlay()), e.setColorOverlay(t.config[t.quality].debugColor))
				}
				afterRenderChunk(e, t) {
					var s
					e.setColorOverlay(null !== (s = this.prevColor.get(t)) && void 0 !== s ? s : null)
				}
			}
			class TextureScoreRenderPass extends MeshRenderPass {
				constructor() {
					super(...arguments), (this.prevColor = new WeakMap())
				}
				beforeRender() {
					;(this.maxValue = this.slots.reduce((e, t) => Math.max(e, t.screenCoverageScore), 1e-9)), super.beforeRender()
				}
				beforeRenderChunk(e, t) {
					const s = t.screenCoverageScore / this.maxValue,
						r = new B.Vector4(s, s, s, 1)
					this.prevColor.set(t, e.getColorOverlay()), e.setColorOverlay(r)
				}
				afterRenderChunk(e, t) {
					var s
					e.setColorOverlay(null !== (s = this.prevColor.get(t)) && void 0 !== s ? s : null)
				}
			}
			var ae = s(40324),
				oe = s(58232),
				ne = s(57937),
				he = s(17916)
			class MeshTextureSlot {
				constructor(e, t, s = he.V.Standard, r) {
					;(this.streamStyle = t),
						(this.lod = s),
						(this.chunks = new Set()),
						(this.loading = !1),
						(this.screenCoverage = 0),
						(this.screenCoverageScore = 0),
						(this.sightings = new oe.P(100)),
						(this.textureName = e),
						(this.streamStyle = t),
						(this.lod = s),
						(this.config = (0, ae.lT)(this.streamStyle)),
						(this.minQuality = (0, ae.q6)(this.streamStyle, s)),
						r && ((this.quality = r), (this.minQuality = this.quality)),
						(this.maxQuality = this.minQuality),
						(this.targetQuality = this.minQuality)
				}
				setTexture(e) {
					this.texture && this.texture !== e && this.texture.dispose(), (this.texture = e)
					for (const e of this.chunks) e.setMeshTexture(this.texture)
				}
				async getUrl(e) {
					const t = this.config[e],
						{ assetType: s } = t
					if (this.textureData) {
						const e = this.textureName.match(/[_.]([0-9]{3})[_.]/)
						if (!e) throw new Error(`Could not parse texture index from texture name: ${this.textureName}`)
						return (await this.textureData[s].get()).urlTemplate.replace("<texture>", e[1])
					}
					{
						if (this.streamStyle === ne.o.TILE) return `${N.Sq}/textures_${s}/${this.textureName}.jpg`
						const e = this.textureName.match(/^([a-f0-9]+(_10k|_50k)?)/)
						if (!e) throw new Error(`Unknown format for texture name: ${this.textureName}`)
						return `${e[0]}_texture_jpg_${s}/${this.textureName}`
					}
				}
			}
			class TextureBudgeter {
				constructor() {
					;(this.lods = new Map()), (this.orders = {}), (this.qualMin = 1 / 0), (this.qualMax = -1 / 0)
				}
				updateBudgetForStyle(e, t) {
					;(this.streamStyle = e),
						(this.slots = t),
						(this.config = (0, ae.lT)(this.streamStyle)),
						t.forEach(e => {
							const t = this.lods.get(e.lod) || new Set()
							t.add(e), this.lods.set(e.lod, t)
						})
					for (const [e] of this.lods.entries())
						(this.orders[e] = (0, ae.Oc)(this.streamStyle, e)),
							(this.qualMin = Math.min(this.qualMin, (0, ae.q6)(this.streamStyle, e)))
					this.baseSizeUnit = this.config[this.qualMin].textureSize
					let s = 0
					for (const [e, t] of this.lods.entries()) {
						const r = (0, ae.t3)(this.streamStyle, e)
						;(s += t.size * this.getBudgetSize(r)), (this.qualMax = Math.max(this.qualMax, r))
					}
					return (this.maxBudget = s), (this.minBudget = this.slots.length), (this._budget = this.minBudget), this
				}
				update(e) {
					this.budget = this.maxBudget
				}
				getBudgetSize(e) {
					return e ? (this.config[e].textureSize / this.baseSizeUnit) ** 2 : 0
				}
				calcCurrentUsedBudget() {
					return this.slots.reduce((e, t) => e + this.getBudgetSize(t.quality), 0)
				}
				clampBudget(e) {
					return Math.min(this.maxBudget, Math.max(this.minBudget, e))
				}
				get budget() {
					return this._budget
				}
				set budget(e) {
					;(e = this.clampBudget(e)), this.budget !== e && ((this._budget = e), this.updateTargetQualitiesFromBudget())
				}
				updateTargetQualitiesFromBudget() {
					let e = 0
					for (const t of this.slots) (t.targetQuality = t.minQuality), (e += this.getBudgetSize(t.targetQuality))
					for (const [t, s] of this.lods.entries())
						for (const r of this.orders[t])
							for (const t of s)
								if (!(t.maxQuality < r)) {
									if (((e -= this.getBudgetSize(t.targetQuality)), (e += this.getBudgetSize(r)), e > this.budget))
										return
									t.targetQuality = r
								}
				}
			}
			var de = s(69626),
				le = s(27408),
				ue = s(67502),
				ce = s(84303),
				me = s(76863),
				ge = s(21922),
				pe = s(86980),
				fe = s(44283)
			class ChunkVisibilityChecker {
				constructor(e, t, s) {
					;(this.scene = e),
						(this.raycaster = t),
						(this.issueCommand = s),
						(this.chunkSightings = new Map()),
						(this.raycastCounter = 0),
						(this.onNewSighting = new Set()),
						(this.raycastRandomScreenLocation = (() => {
							const e = new B.Vector3(),
								t = new B.Vector3(),
								s = new B.Vector3()
							return (r, i, a) => {
								this.raycastCounter++
								const o = (2 - 2 * i) / r,
									n = -1 + i,
									h = this.raycastCounter % (r * r),
									d = h % r,
									l = n + ((h - d) / r) * o,
									u = n + d * o + Math.random() * o,
									c = l + Math.random() * o
								e.set(u, c, -1).unproject(this.camera),
									t.set(u, c, 1).unproject(this.camera),
									s.subVectors(t, e).normalize()
								const m = this.raycaster.pick(e, s, me.Pv)
								if (m) {
									if (m.face && m.object instanceof ge.g) {
										const e = m.object.getChunk(m.face.materialIndex),
											t = e.meshSubgroup,
											s = {
												point: m.point.clone(),
												raycastAge: this.raycastCounter
											}
										this.chunkSightings.set(t, s)
										for (const t of this.onNewSighting.values()) t(e, s)
									}
									a && a(m)
								}
							}
						})()),
						(this.camera = e.camera)
				}
				update() {
					if (!this.gatherTaskPromise) {
						const e = () => {
								const e = N.ZP.debugLOD ? (0, pe.e)(65280, this.scene) : void 0,
									t = performance.now()
								for (; performance.now() - t < 1.5; ) this.raycastRandomScreenLocation(5, 0.05, e)
							},
							t = async e => {
								await e.promise, (this.gatherTaskPromise = null)
							},
							s = new ue._("mesh/texture/raycast", e, 50)
						this.gatherTaskPromise = this.issueCommand(s).then(t)
					}
				}
				chunkVisible(e, t = 1e3) {
					const s = this.chunkSightings.get(e)
					return !!s && this.raycastCounter - s.raycastAge < t
				}
				notifyOnNewSighting(e) {
					return (0, fe.k1)(
						() => this.onNewSighting.add(e),
						() => this.onNewSighting.delete(e),
						!0
					)
				}
			}
			const ye = new L.Z("tex-lod")
			class MeshTextureLoader {
				constructor(e, t, s, r, i, a, o, n, h) {
					;(this.textureLOD = e),
						(this.urls = t),
						(this.modelObject = s),
						(this.camera = r),
						(this.cameraData = i),
						(this.renderer = a),
						(this.renderToTextureModule = o),
						(this.engine = n),
						(this.chunkVisibilityChecker = h),
						(this.name = "texture-streaming"),
						(this.slots = []),
						(this.textureNameToSlot = {}),
						(this.chunkIdToSlot = {}),
						(this.concurrentLoadingTextures = 1),
						(this.concurrentDownloadingTiles = 12),
						(this.autoLoadTiles = !1),
						(this.lastSortedAt = 0),
						(this.loadingTextures = 0),
						(this.downloadingTiles = 0),
						(this.totalTextures = {}),
						(this.totalTiles = 0),
						(this.textureQualityRenderPass = new TextureQualityRenderPass(this.slots, this.renderToTextureModule)),
						(this.textureScoreRenderPass = new TextureScoreRenderPass(this.slots, this.renderToTextureModule)),
						(this._chunkSlotsSet = new Set())
				}
				setModel(e, t, s, r) {
					;(this.streamingStyle = e),
						(this.textures = r),
						(this.minQuality = (0, ae.q6)(this.streamingStyle)),
						(this.maxQuality = (0, ae.t3)(this.streamingStyle)),
						(this.modelObject = t),
						(this.slots.length = 0),
						(this.textureNameToSlot = {}),
						(this.chunkIdToSlot = {}),
						this.addChunkSlots([...s]),
						(this.textureBudgeter = new TextureBudgeter().updateBudgetForStyle(this.streamingStyle, this.slots)),
						this.chunkVisibilityChecker.notifyOnNewSighting((e, t) => {
							const s = this.addChunkSlots([e])
							for (const e of s) e.sightings.push(t)
						})
				}
				addChunkSlots(e) {
					this._chunkSlotsSet.clear()
					let t = !1
					for (const s of e) {
						const e = s.textureName
						let r = this.textureNameToSlot[e]
						if (!r) {
							let i
							;(t = !0),
								s.textureSizeEmbedded && (i = (0, ae.RQ)(s.textureSizeEmbedded, this.streamingStyle, s.lod)),
								(r = new MeshTextureSlot(e, this.streamingStyle, s.lod, i)),
								(r.maxTextureAssetSize = s.textureSizeMax),
								this.textures && (r.textureData = this.textures),
								(this.textureNameToSlot[s.textureName] = r),
								this.slots.push(r)
						}
						r.chunks.has(s) || ((t = !0), r.chunks.add(s)), this._chunkSlotsSet.add(r), (this.chunkIdToSlot[s.id] = r)
					}
					return (
						t && this.textureBudgeter && this.textureBudgeter.updateBudgetForStyle(this.streamingStyle, this.slots),
						this._chunkSlotsSet
					)
				}
				setQuality(e, t) {
					if (e > t) throw new Error("min quality must be smaller or equal to max")
					;(this.minQuality = e), (this.maxQuality = t)
					for (const e of this.slots)
						(e.minQuality = Math.max((0, ae.q6)(e.streamStyle, e.lod), this.minQuality)),
							(e.maxQuality = Math.min(e.maxQuality, this.maxQuality))
				}
				get textureCount() {
					return this.slots.length
				}
				loadAll(e) {
					if (!this.slots[0] || !this.slots[0].textureName) return Promise.resolve([])
					this.streamingStyle !== ne.o.DAM &&
						ye.error(
							`textureStreaming.loadAll(${ae.S7[e]}) not supported with tiles, quality is different per lod`,
							this.slots
						)
					const t = this.slots.map(t => this.loadTexture(t, e, !1))
					return Promise.all(t)
				}
				async loadTexture(e, t, s = !0) {
					const r = (0, ae.lT)(this.streamingStyle)
					t in r || ye.warn(ae.S7[t], "not found in", this.streamingStyle, r)
					const i = r[t],
						a = e.maxTextureAssetSize || i.assetSize,
						o = Math.min(a, i.textureSize)
					e.lastLoadedAt = performance.now()
					let n = e.texture
					if (n && t === e.quality) return ye.info(`Texture was already at level ${ae.S7[t]}, not reloading`), e.texture
					if (n && t < e.quality) {
						const s = this.renderToTextureModule.resizeTexture(n, o)
						return (e.quality = t), e.setTexture(s), e.texture
					}
					;(n = new B.Texture()),
						(n.format = B.RGBFormat),
						this.renderer.initSizedTexture2D(o, n),
						(e.loading = !0),
						this.loadingTextures++,
						(this.totalTextures[o] = (this.totalTextures[o] || 0) + 1)
					try {
						;(n.sourceFile = await e.getUrl(t)),
							this.textureLOD !== R.l.NONE && s
								? await this.updateTextureTiled(n, t, e)
								: await this.updateTextureSolid(n, t),
							e.setTexture(n)
					} catch (e) {
						ye.warn(`Failed loading texture ${n.sourceFile}`, e)
					} finally {
						this.loadingTextures--, (e.quality = t), (e.loading = !1)
					}
					return n
				}
				async updateTextureTiled(e, t, s) {
					;(e.generateMipmaps = !1), (e.minFilter = B.LinearFilter), (e.magFilter = B.LinearFilter)
					const r = (0, ae.lT)(this.streamingStyle),
						i = void 0 !== s.maxTextureAssetSize ? s.maxTextureAssetSize : r[t].assetSize,
						a = Math.min(i, r[t].textureSize),
						o = Math.min(a, r[t].tileSize),
						n = i / (a / o),
						h = async (t, s) => {
							const r = {}
							let h
							n !== o && (r.width = `${o}`),
								n !== i && (r.crop = `${n},${n},x${t / a},y${s / a}`),
								(this.downloadingTiles += 1),
								(this.totalTiles += 1)
							try {
								h = await this.urls.getImageBitmap(
									e.sourceFile,
									o,
									o,
									{
										priority: ie.RequestPriority.LOW,
										flipY: N.ZP.flipDownload
									},
									r
								)
							} finally {
								this.downloadingTiles -= 1
							}
							const d = t,
								l = N.ZP.flipUpload ? a - s - o : s,
								u = new ue._(
									"mesh/texture/upload-tiles",
									() =>
										this.engine.after(ce.A.End).then(() => {
											this.renderer.uploadTexture2D(h, e, d, l)
										}),
									100
								)
							return (await this.engine.commandBinder.issueCommand(u)).promise
						},
						d = []
					for (let e = 0; e < a; e += o) for (let t = 0; t < a; t += o) d.push(h(e, t))
					return Promise.all(d)
				}
				async updateTextureSolid(e, t) {
					const s = (0, ae.lT)(this.streamingStyle),
						{ textureSize: r } = s[t],
						i = N.ZP.flipDownload,
						a = await this.urls.getImageBitmap(
							e.sourceFile,
							r,
							r,
							{ priority: ie.RequestPriority.LOW, flipY: i },
							{ width: `${r}` }
						)
					this.renderer.uploadTexture2D(a, e, 0, 0)
				}
				analyzeTextureScreenCoverageFromRaycasts() {
					const e = window.innerWidth,
						t = new B.Vector3().copy(this.cameraData.pose.position)
					for (const s of this.slots) {
						;(s.screenCoverage = 0), (s.screenCoverageScore = 0), (s.maxQuality = s.minQuality)
						for (const r of s.sightings) {
							if (this.chunkVisibilityChecker.raycastCounter - r.raycastAge > 1e3) continue
							const i = t.distanceTo(r.point),
								a = (0, de._U)(i, this.camera.projectionMatrix, e)
							let o = (0, ae.RQ)(a, this.streamingStyle, s.lod)
							;(o = Math.min(o, this.maxQuality)),
								(s.screenCoverageScore += o),
								(s.screenCoverage += 1),
								(s.maxQuality = Math.max(o, s.maxQuality))
						}
					}
					this.slots.sort((e, t) => t.screenCoverageScore - e.screenCoverageScore),
						this.textureBudgeter.updateTargetQualitiesFromBudget()
				}
				update(e) {
					if ((this.textureBudgeter.update(e), !this.camera || !this.autoLoadTiles)) return
					const t = performance.now()
					this.textureLOD === R.l.RAYCAST && this.minQuality !== this.maxQuality && this.scheduleRaycastTasks(t)
					for (let e = this.slots.length - 1; e >= 0; e--) {
						const s = this.slots[e],
							r = (0, le.uZ)(s.targetQuality, s.minQuality, s.maxQuality),
							i = t - s.lastLoadedAt < 1e3
						if (!s.loading && s.quality > r && !i) {
							this.loadTexture(s, r)
							break
						}
					}
					for (const e of this.slots) {
						if (
							this.loadingTextures >= this.concurrentLoadingTextures ||
							this.downloadingTiles >= this.concurrentDownloadingTiles
						)
							break
						const t = (0, le.uZ)(e.targetQuality, e.minQuality, e.maxQuality)
						!e.loading && e.quality < t && this.loadTexture(e, (0, ae.Bl)(e.quality, this.streamingStyle, e.lod))
					}
					N.ZP.debugRttScores &&
						this.textureScoreRenderPass.render(this.modelObject, this.camera, !0, N.ZP.debugRttClear),
						N.ZP.debugRttQuality &&
							this.textureQualityRenderPass.render(this.modelObject, this.camera, !0, N.ZP.debugRttClear)
				}
				scheduleRaycastTasks(e) {
					if (!this.analyzeTaskPromise && e - this.lastSortedAt > 200) {
						const e = () => {
								this.analyzeTextureScreenCoverageFromRaycasts(), (this.lastSortedAt = performance.now())
							},
							t = async e => {
								await e.promise, (this.analyzeTaskPromise = null)
							},
							s = new ue._("mesh/texture/analyze-screen-coverage", e, 100)
						this.analyzeTaskPromise = this.engine.commandBinder.issueCommand(s).then(t)
					}
				}
			}
			var xe = s(32653)
			class ModelMeshModule extends r.Y {
				constructor() {
					super(...arguments),
						(this.name = "model-mesh"),
						(this.colorOverlay = null),
						(this.toggleMeshOverlayColor = e => {
							this.colorOverlay || (this.colorOverlay = new MeshOverlayColor(() => this.modelMesh.chunks)),
								this.colorOverlay.toggleEnabled(e)
						}),
						(this.meshTrimAdded = e => {
							e.onPropertyChanged("enabled", () => this.updateMeshTrim(e)), this.setTrimsForFloor(e.floorIndex)
						}),
						(this.meshTrimRemoved = e => {
							e.removeOnPropertyChanged("enabled", () => this.updateMeshTrim(e)), this.setTrimsForFloor(e.floorIndex)
						}),
						(this.updateMeshTrim = e => {
							const t = this.meshTrimUniforms.setMeshTrim(e)
							this.modelMesh.chunks.forEach(s => {
								s.meshGroup === e.floorIndex && s.setMaterialsUniform(t)
							})
						}),
						(this.updateMaxQuality = (() => {
							let e, t, s
							return ({ modeChange: r, criticalChange: i, interactionChange: a }) => {
								void 0 !== i && (t = i), void 0 !== r && (e = r), void 0 !== a && (s = a)
								const o = s === l.s.VrOrientOnly || s === l.s.VrWithController || s === l.s.VrWithTrackedController,
									n =
										this.modelTextureLoader.textureCount <= this.config.textureLODThreshold
											? Math.max(ae.S7.ULTRA, this.config.maxQuality)
											: (0, ae.Bl)((0, ae.q6)(ne.o.DAM, he.V.Standard), ne.o.DAM, he.V.Standard),
									h = Math.max(
										n,
										e === C.Ey.Panorama && 0 === this.meshData.meshTextureOpacity.value ? n : this.config.maxQuality
									)
								this.modelMesh.setTextureQuality(this.modelTextureLoader, n, h)
								const d =
										this.viewmodeData.currentMode !== C.Ey.Dollhouse &&
										this.viewmodeData.currentMode !== C.Ey.Floorplan,
									u = this.viewmodeData.transition.active && (0, C.Bw)(this.viewmodeData.transition.to)
								this.modelTextureLoader.autoLoadTiles = !(o || u || (t && d)) && this.config.textureLOD !== R.l.NONE
							}
						})())
				}
				async init(e, t) {
					I ||
						((B.Mesh.prototype.raycast = F.uL),
						(B.BufferGeometry.prototype.computeBoundsTree = F.Xy),
						(B.BufferGeometry.prototype.disposeBoundsTree = F.sn),
						(I = !0)),
						(this.config = e),
						(this.engine = t),
						(this.market = t.market)
					const [r, h, l, u, f, y, x, w, S, b] = await Promise.all([
							t.getModuleBySymbol(i.y.WEBGL_RENDERER),
							t.getModule(g.default),
							t.getModule(c.default),
							t.market.waitForData(m.T),
							t.getModuleBySymbol(i.y.INPUT),
							t.getModule(p.default),
							t.market.waitForData(d.M_),
							t.market.waitForData(k.O),
							t.market.waitForData(M.Z),
							t.getModuleBySymbol(i.y.SWEEP_PANO)
						]),
						v = await t.getModule(G.default)
					;(this.appData = await t.market.waitForData(n.pu)), (this.sweepData = S), (this.viewmodeData = w)
					const C = r.getScene(),
						O = l.getSignedUrls(),
						_ = u.model.uuid,
						z = t.claimRenderLayer(this.name)
					this.panoRenderer = b.getRenderer()
					const U = new xe.s()
					this.chunkVisibiltyChecker = new ChunkVisibilityChecker(C, h.picking, this.engine.commandBinder.issueCommand)
					const E = v.tryGetProperty(N.iT, !1)
						? await Promise.all([s.e(764), s.e(47), s.e(423), s.e(543), s.e(983)]).then(s.bind(s, 36429))
						: await Promise.all([s.e(947), s.e(321)]).then(s.bind(s, 51344))
					// (this.modelMesh = await E.createModelMesh({
					//   uuid: _,
					//   urls: O,
					//   renderLayer: z,
					//   engine: t,
					//   settings: N.ZP,
					//   roomMeshData: U,
					//   chunkFactory: (e, t, s, r) => new W.z(e, t, s, r),
					//   chunkVisibilityChecker: this.chunkVisibiltyChecker,
					// })),
					this.engine.market.register(this, xe.s, U)
					let A = Promise.resolve()
					const V = this.modelMesh
					this.setupMarketData(V.chunks, S),
						e.renderMeshGeometry &&
							((this.modelTextureLoader = new MeshTextureLoader(
								e.textureLOD,
								O,
								this.modelMesh,
								C.camera,
								x,
								r.cwfRenderer,
								y,
								t,
								this.chunkVisibiltyChecker
							)),
							(this.modelTextureLoader.autoLoadTiles = e.textureLOD !== R.l.NONE),
							(A = this.modelMesh.initTextureLoader(
								this.modelTextureLoader,
								u.model,
								() => {
									this.updateMaxQuality({})
								},
								{
									streamingTextures: e.textureLOD !== R.l.NONE,
									maxQuality: e.maxQuality
								}
							)),
							this.bindAppEventsToTextureQuality()),
						h.setupOctree(this.modelMesh.boundingBox),
						this.modelMesh.registerCollision(f),
						e.renderMeshGeometry &&
							((this.renderer = new ModelRenderer(
								C.scene,
								this.modelMesh,
								this.modelMesh,
								this.panoRenderer,
								this.meshData,
								this.sweepData,
								this.appData,
								e
							)),
							await t.addComponent(this, this.renderer),
							await A),
						this.bindings.push(
							this.engine.subscribe(T.Z, e => {
								this.renderer.updateExistingTexture(e.sweepId, e.renderTarget.texture)
							})
						),
						this.bindings.push(
							t.commandBinder.addBinding(D.I, async e => this.toggleMeshOverlayColor(e.enabled)),
							t.commandBinder.addBinding(P.n, this.setPreviewPosition.bind(this))
						),
						e.meshTrimEnabled ? await this.bindMeshTrimListeners() : this.bindMeshTrimListeners(),
						(0, o.h)("debug", "") && a.Z.load(a.Z.menus.StreamingTexture, t)
				}
				onUpdate(e) {
					this.modelMesh.onUpdate(),
						this.modelTextureLoader && !N.ZP.debugPauseTexStream && this.modelTextureLoader.update(e),
						this.chunkVisibiltyChecker && this.chunkVisibiltyChecker.update(),
						this.meshData.meshTextureOpacity.active &&
							(this.meshData.meshTextureOpacity.updateProgress(this.viewmodeData.transition.progress),
							this.meshData.commit())
					const t = performance.now() / 1e3
					for (const e of this.modelMesh.chunks) e.setTime(t)
				}
				setupMarketData(e, t) {
					const s = new Map(),
						r = new Map(),
						i = new B.Box3()
					e.forEach(e => {
						e.geometry.boundingBox && i.union(e.geometry.boundingBox),
							s.set(e.meshGroup, (s.get(e.meshGroup) || []).concat(e)),
							r.set(e.meshSubgroup, (r.get(e.meshSubgroup) || []).concat(e))
					})
					const a = new B.Box3()
					t.iterate(e => {
						e.isUnplaced() || (a.setFromCenterAndSize(e.position, h.f.UNIT), i.union(a))
					})
					const o = new _._(0, [...i.min.toArray(), ...i.max.toArray()])
					for (const [e, t] of s.entries()) {
						const s = new B.Box3()
						t.forEach(e => {
							e.geometry.boundingBox && s.union(e.geometry.boundingBox)
						}),
							o.meshGroups.floors.add({
								meshGroup: e,
								boundingBox: s,
								parentMeshGroup: null
							})
						const i = [...new Set(t.map(e => e.meshSubgroup))]
							.sort((e, t) => t - e)
							.map(t => ({ meshGroup: e, meshSubgroup: t }))
						o.meshGroups.roomsByFloor.set(e, i)
						for (const t of i) {
							const { meshSubgroup: s } = t,
								i = new B.Box3()
							;(r.get(s) || []).forEach(e => {
								e.geometry.boundingBox && i.union(e.geometry.boundingBox)
							})
							const a = { meshGroup: s, boundingBox: i, parentMeshGroup: e }
							o.meshGroups.rooms.get(e, s) &&
								this.log.warn(
									"Duplicate room meshSubgroup found in model - \nold:",
									o.meshGroups.rooms.get(e, s),
									"\nnew:",
									a
								),
								o.meshGroups.rooms.set(e, s, a),
								o.meshGroupVisuals.roomFadeDist.set(e, s, 0)
						}
						o.meshGroupVisuals.floorOpacity.set(e, 1)
					}
					;(this.meshData = o),
						this.meshData.onMeshIdsUpdated(this.onMeshIdsUpdated.bind(this)),
						this.market.register(this, _._, this.meshData)
				}
				onMeshIdsUpdated() {
					const e = this.meshData.meshGroups
					Object.keys(e.floorIds).length &&
						Object.keys(e.roomIds).length &&
						this.modelMesh.onMeshIdsUpdated(this.meshData.meshGroups)
				}
				startOpacityTransition() {
					const e = this.viewmodeData.transition.to,
						t = this.meshData.meshTextureOpacity.value,
						s = e === C.Ey.Panorama ? 0 : 1,
						r = e === C.Ey.Panorama ? O.Q9 : O.w2
					this.meshData.meshTextureOpacity.value !== s && this.meshData.meshTextureOpacity.modifyAnimation(t, s, 1, r)
				}
				setMeshOpacity(e) {
					e !== this.meshData.meshTextureOpacity.value &&
						(this.meshData.meshTextureOpacity.modifyAnimation(e, e, 0), this.meshData.commit())
				}
				async bindMeshTrimListeners() {
					;(this.meshTrimData = await this.engine.market.waitForData(w.Z)),
						(this.meshTrimUniforms = new MeshTrimUniforms())
					const { meshTrimsByFloorIndex: e } = this.meshTrimData
					e.keys.forEach(t => {
						const s = e.get(t)
						this.bindings.push(
							s.onElementChanged({
								onAdded: this.meshTrimAdded,
								onRemoved: this.meshTrimRemoved
							})
						),
							s.forEach(e => {
								e.onPropertyChanged("enabled", () => this.updateMeshTrim(e))
							}),
							this.setTrimsForFloor(t)
					})
				}
				setTrimsForFloor(e) {
					const t = `${e}`,
						s = this.meshTrimData.getTrimsForFloor(t),
						r = this.meshTrimUniforms.updateMeshTrimArrays(t, s)
					this.modelMesh.chunks.forEach(e => {
						;`${e.meshGroup}` === t && e.setMaterialsUniform(r)
					})
				}
				bindAppEventsToTextureQuality() {
					let e = 0
					this.bindings.push(
						this.appData.onPropertyChanged("phase", () => this.updateMaxQuality({})),
						this.meshData.onChanged(t => {
							t.meshTextureOpacity !== e && this.updateMaxQuality({}), (e = t.meshTextureOpacity)
						}),
						this.engine.subscribe(b.Z, e => {
							this.startOpacityTransition(),
								this.updateMaxQuality({
									criticalChange: !0,
									modeChange: e.toMode
								})
						}),
						this.engine.subscribe(v.Z, e => {
							this.updateMaxQuality({
								criticalChange: !1,
								modeChange: e.toMode
							})
						}),
						this.engine.subscribe(S.oR, () => {
							this.updateMaxQuality({ criticalChange: !0 })
						}),
						this.engine.subscribe(S.NR, () => {
							this.updateMaxQuality({ criticalChange: !1 })
						}),
						this.engine.subscribe(f.Z, () => {
							this.updateMaxQuality({ criticalChange: !0 })
						}),
						this.engine.subscribe(y.Z, e => {
							this.sweepData.getSweep(e.toSweep).isAligned() || this.setMeshOpacity(0)
						}),
						this.engine.subscribe(x.Z, () => {
							this.updateMaxQuality({ criticalChange: !1 })
						}),
						this.engine.subscribe(u.m, e => {
							this.updateMaxQuality({ interactionChange: e.mode })
						})
					)
				}
				async setPreviewPosition(e) {
					const t = e.enabled && e.previewCirclePosition ? e.previewCirclePosition : null,
						s = e.size ? e.size : 0.3
					for (const e of this.modelMesh.chunks) e.setMeshPreviewSphere(t, s)
				}
			}
		},
		51344: (e, t, s) => {
			"use strict"
			s.r(t), s.d(t, { createModelMesh: () => M })
			var r = s(93331),
				i = s(84561),
				a = s(8511),
				o = s(31102)
			class MeshCreationException extends o.y {
				constructor(e) {
					super(e), (this.name = "MeshCreationException")
				}
			}
			var n = s(2212),
				h = s(21922),
				d = s(38493)
			class FloorMesh extends n.Object3D {
				constructor(e, t = i.o.ALL) {
					super(),
						(this.renderLayer = t),
						(this.roomMeshes = new d.Z(e => e.meshSubgroup)),
						(this.boundingBox = new n.Box3()),
						(this.size = new n.Vector3()),
						(this.center = new n.Vector3()),
						(this._chunks = []),
						(this.built = !1),
						(this.name = `FloorMesh:${e}`),
						(this.meshGroup = e),
						(this.floorId = void 0)
				}
				dispose() {
					this.reset(), this.roomMeshes.clear()
				}
				reset() {
					for (const e of this.roomMeshes) e.dispose(), this.remove(e)
					;(this._chunks.length = 0), (this.built = !1)
				}
				addChunk(e) {
					const t = this.getOrCreateRoomMesh(e.meshSubgroup)
					this._chunks.push(e), t.addChunk(e)
				}
				build() {
					if (this.built) throw new Error("build() should only be called once")
					this.boundingBox.makeEmpty()
					for (const e of this.roomMeshes) this.add(e), this.boundingBox.union(e.boundingBox)
					;(this.center = this.boundingBox.getCenter(this.center)),
						(this.size = this.boundingBox.getSize(this.size)),
						(this.built = !0)
				}
				get chunks() {
					return this._chunks
				}
				getOrCreateRoomMesh(e) {
					let t = this.roomMeshes.get(e)
					return t || ((t = new h.g(this.meshGroup, e, this.renderLayer)), this.roomMeshes.add(t), this.add(t)), t
				}
			}
			var l = s(62955),
				u = s(40324),
				c = s(88512),
				m = s(2388),
				g = s(3614),
				p = s(19131)
			const f = new c.Z("dam-loader")
			class DamLoader {
				constructor() {
					this.decoder = s(92011).uO
				}
				async load(e, t, s) {
					f.time("download")
					const r = await t.getFile(e, {
						responseType: "arraybuffer",
						onProgress: s
					})
					return f.timeEnd("download"), this.parse(r)
				}
				parse(e) {
					f.time("parse proto")
					const t = this.decoder.read(new g(e))
					f.timeEnd("parse proto"), f.time("convert to webgl")
					const s = this.convertProtobufToSceneObject(t)
					return f.timeEnd("convert to webgl"), s
				}
				convertProtobufToSceneObject(e) {
					if (0 === e.chunk.length) return f.warn("No chunks in damfile..."), []
					const t = new n.Matrix4()
					return (
						t.set(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1),
						e.chunk.map(function (e) {
							const s = new n.BufferGeometry()
							s.setAttribute("position", new n.BufferAttribute(new Float32Array(e.vertices.xyz, 0, 3), 3)),
								e.vertices.uv.length > 0 &&
									s.setAttribute("uv", new n.BufferAttribute(new Float32Array(e.vertices.uv, 0, 2), 2)),
								s.setIndex(new n.BufferAttribute(new Uint32Array(e.faces.faces, 0, 1), 1)),
								s.applyMatrix4(t),
								s.computeBoundingBox()
							const { group: r, subgroup: i } = (0, p.xc)(e.chunk_name)
							return new a.z(r, i, s, e.material_name)
						})
					)
				}
			}
			var y = s(57937)
			const x = new c.Z("mesh")
			class ModelMeshDam extends l.e {
				constructor(e, t, s = i.o.ALL) {
					super(),
						(this.renderLayer = s),
						(this.floorMeshes = new d.Z(e => e.meshGroup)),
						(this.built = !1),
						(this.uuid = e),
						(this.name = `ModelMesh:${e}`),
						(this.signedUrls = t),
						(this.layers.mask = s.mask)
				}
				dispose() {
					this.floorMeshes.mapElements(e => {
						e.dispose(), this.remove(e)
					}),
						this.floorMeshes.clear(),
						(this._chunks.length = 0),
						(this.built = !1)
				}
				reset() {
					this.floorMeshes.mapElements(e => {
						e.reset(), this.remove(e)
					}),
						(this._chunks.length = 0),
						(this.built = !1)
				}
				async load(e = {}) {
					const { roomMeshData: t } = e
					let s = e.chunks
						? e.chunks
						: await class ModelLoader {
								static async load(e, t, s, r = 0) {
									const i = new DamLoader()
									m.ZP.highQualityDam && 0 === r && (r = 1)
									const a = (t.meshUrls
										? t.meshUrls
										: [
												{ suffix: "_50k", extension: "dam" },
												{ suffix: "", extension: "dam" }
										  ])[r]
									if (!a) return Promise.reject("No suitable model file found...")
									const { url: o, suffix: n, extension: h } = a,
										d = o ? await o.get() : `${e}${n}.${h}`
									return i.load(d, t, s).catch(() => this.load(e, t, s, ++r))
								}
						  }
								.load(this.uuid, this.signedUrls, e.onProgress)
								.catch(e => {
									x.error(e)
									const t = e instanceof Error ? e.message : "Failed to load model mesh"
									throw new MeshCreationException(t)
								})
					if (0 === s.length) {
						x.warn("No geometry found for model, loading faux geometry, disabling outside view-mode")
						const e = new n.PlaneBufferGeometry(5, 5, 1, 1)
						e.rotateX(-Math.PI / 2), e.computeBoundingBox()
						const t = new a.z(0, 0, e)
						t.forEachMaterial(e => (e.visible = !1)), (s = [t])
					}
					s.forEach((e, t) => {
						this.addChunk(e)
					}),
						this.build(t)
				}
				addChunk(e) {
					const t = this.getOrCreateFloorMesh(e.meshGroup)
					this._chunks.push(e), t.addChunk(e)
				}
				build(e) {
					if (this.built) throw new Error("build() should only be called once")
					let t = 0,
						s = 0
					for (const e of this.floorMeshes) {
						this.add(e)
						for (const s of e.roomMeshes)
							s.build(), s.geometry.computeBoundsTree && !s.geometry.boundsTree && s.geometry.computeBoundsTree(), t++
						e.build(), s++
					}
					x.debug(`FloorMeshes: ${s} RoomMeshes: ${t} Chunks: ${this._chunks.length}`), this.boundingBox.makeEmpty()
					for (const e of this.floorMeshes) this.boundingBox.union(e.boundingBox)
					;(this.size = this.boundingBox.getSize(this.size)),
						(this.center = this.boundingBox.getCenter(this.center)),
						(e.floors = new Set(this.floorMeshes)),
						(e.rooms = this.roomMeshes),
						e.commit(),
						(this.built = !0)
				}
				get roomMeshes() {
					const e = new Set()
					for (const t of this.floorMeshes) for (const s of t.roomMeshes) e.add(s)
					return e
				}
				setSide(e) {
					for (const t of this.floorMeshes) for (const s of t.roomMeshes) this.setSideRecursively(s, e)
				}
				initTextureLoader(e, t, s, r) {
					e.setModel(y.o.DAM, this, this.chunks, t.textures)
					const i = r.streamingTextures ? (0, u.q6)(y.o.DAM) : r.maxQuality
					return e.loadAll(i).then(() => {
						s()
					})
				}
				registerCollision(e) {
					e.registerMesh(this, !0)
					for (const t of this.roomMeshes) e.registerSnappingMesh(t)
				}
				onMeshIdsUpdated(e) {
					for (const t of this.floorMeshes) {
						for (const s of t.roomMeshes)
							(s.floorId = e.floorIds[s.meshGroup]), (s.roomId = e.roomIds.get(s.meshGroup, s.meshSubgroup) || "")
						const s = e.floorIds[t.meshGroup]
						t.floorId = s
					}
				}
				setTextureQuality(e, t, s) {
					e.setQuality(t, s)
				}
				onUpdate() {}
				setSideRecursively(e, t) {
					e instanceof n.Mesh && e.material && e.material instanceof n.MeshBasicMaterial && (e.material.side = t)
					for (const s of e.children) this.setSideRecursively(s, t)
				}
				getOrCreateFloorMesh(e) {
					let t = this.floorMeshes.get(e)
					return t || ((t = new FloorMesh(e, this.renderLayer)), this.floorMeshes.add(t), this.add(t)), t
				}
			}
			async function M({ uuid: e, urls: t, renderLayer: s, engine: i, roomMeshData: a }) {
				const o = new ModelMeshDam(e, t, s)
				return (
					await o.load({
						roomMeshData: a,
						onProgress: e => {
							i.broadcast(new r.Z(e.loaded, e.total))
						}
					}),
					o
				)
			}
		},
		86980: (e, t, s) => {
			"use strict"
			s.d(t, { e: () => o, M: () => n })
			var r = s(2212)
			const i = []
			let a = 0
			const o = (e, t) => {
					if (0 === i.length)
						for (let e = 0; e < 100; e++) {
							const e = new r.Mesh(new r.SphereBufferGeometry(0.005), new r.MeshBasicMaterial())
							i.push(e)
						}
					return s => {
						const r = i[a++ % i.length]
						r.position.copy(s.point),
							r.scale.set(s.distance, s.distance, s.distance),
							r.material.color.setHex(e),
							r.parent || t.scene.add(r)
					}
				},
				n = i
		},
		19131: (e, t, s) => {
			"use strict"
			s.d(t, { xc: () => i, ko: () => a, k7: () => o })
			var r = s(2212)
			function i(e) {
				const t = e.match(/group([0-9]+)/),
					s = e.match(/sub([0-9]+)/),
					r = e.match(/type([0-9]+)/),
					i = e.match(/mirror([0-9]+)/),
					a = e.match(/window([0-9]+)/),
					o = e.match(/chunk([0-9]+)/),
					n = e.match(/_chunk([0-9]+)/),
					h = r ? parseInt(r[1], 10) : i && !isNaN(parseInt(i[1], 10)) ? 100 : a && !isNaN(parseInt(a[1], 10)) ? 101 : 0
				return {
					group: t ? parseInt(t[1], 10) : 0,
					subgroup: s ? parseInt(s[1], 10) : 0,
					chunkIndex: o ? parseInt(o[1], 10) : 0,
					nodeIndex: n ? parseInt(n[1], 10) : 0,
					type: h
				}
			}
			function a(e, t = !1) {
				let s = e.getAttribute("barycentric")
				if (s) return s
				const i = (e.getIndex() || e.getAttribute("position")).count / 3,
					a = []
				for (let e = 0; e < i; e++) {
					const s = t ? 1 : 0
					e % 2 == 0 ? a.push(0, 0, 1, 0, 1, 0, 1, 0, s) : a.push(0, 1, 0, 0, 0, 1, 1, 0, s)
				}
				const o = new Float32Array(a)
				return (s = new r.BufferAttribute(o, 3)), e.setAttribute("barycentric", s), s
			}
			function o(e = 16777215 * Math.random(), t = 1) {
				const s = (function (e, t, s, r = 1) {
						const i = document.createElement("canvas")
						;(i.width = t), (i.height = s)
						const a = i.getContext("2d")
						return (
							(a.fillStyle = `rgba(${(255 * e.r) | 0},${(255 * e.g) | 0},${(255 * e.b) | 0}, ${(255 * r) | 0})`),
							a.fillRect(0, 0, t, s),
							i
						)
					})(new r.Color(e), 1, 1, t),
					i = new r.CubeTexture([s, s, s, s, s, s])
				return (i.format = r.RGBAFormat), (i.needsUpdate = !0), i
			}
		},
		64807: (e, t, s) => {
			"use strict"
			s.d(t, { Z: () => PanoRenderTargetResizedMessage })
			var r = s(91466)
			class PanoRenderTargetResizedMessage extends r.v {
				constructor(e, t, s) {
					super(), (this.size = e), (this.sweepId = t), (this.renderTarget = s)
				}
			}
		}
	}
])
